< previous page page_286 next page >

Page 286
You can also use Visual Basic syntax to combine several data table columns into a single column in the result set. Enter and execute the following example and compare your results to Figure 8.18.
SELECT Name, City+", "+StateProv+"  "+Zip AS ADDRESS
   FROM Publishers
0286-01.jpg
Figure 8.18.
Using Visual Basic syntax to combine columns.
You can also use Visual Basic functions as part of the WHERE clause in an SQL statement. The following example (Figure 8.19) returns only rows that have the letter a as the second character in the Name column.
SELECT Name FROM Publishers
   WHERE Mid$(Name,2,1)="a"
0286-02.jpg
Figure 8.19.
Using Visual Basic functions
in an SQL 
WHERE clause.
Even though using familiar Visual Basic functions and syntax is very handy, it has its drawbacks. Chief among them is the fact that after you create an SQL statement that uses

 
< previous page page_286 next page >

If you like this book, buy it!